import {
  ElMessage
} from "element-plus";
export function saveJSON(jsonData, asFilename) {
  const filename = asFilename || `${new Date().toISOString()}.json`;
  const data =
    typeof jsonData === "object"
      ? JSON.stringify(jsonData, undefined, 2)
      : jsonData;
  const blob = new Blob([data], { type: "text/json" });
  const link = document.createElement("a");
  link.setAttribute("style", "display: none");
  link.download = filename;
  link.href = window.URL.createObjectURL(blob);
  link.dataset.downloadurl = ["text/json", link.download, link.href].join(":");
  document.body.appendChild(link);
  link.click();
  document.body.removeChild(link);
  ElMessage('成功导出json文件')
}